home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 271_02 / crc.doc < prev    next >
Text File  |  1987-08-18  |  1KB  |  40 lines

  1.  
  2.  
  3.        NAME
  4.                crc functions -- crc misc. functions
  5.  
  6.        SYNOPSIS
  7.                short crc_clear();       clear crc value
  8.                short crc_update(crc, chr);    update crc value
  9.                short crc_finish(crc);   finish crc calculation
  10.  
  11.        DESCRIPTION
  12.        These functions are used in crc calculations mainly for
  13.        modem programs.  crc_clear is used to clear the crc value.
  14.        However, if speed is a concern, just zero the crc value since
  15.        crc_clear does nothing other than return a zero.
  16.        crc_update is called once for each character to add to the crc.
  17.        It receives the running crc and the character to be added.
  18.        crc_finish actually calls crc_update twice with a value of
  19.        0 in order to flush the 16 bit calculation and return the final crc
  20.        calculation.  As supplied, the CCITT calculation polynomial is
  21.        used.  The source can be easily changed to CRC16 if desired.
  22.  
  23.        EXAMPLE
  24.               short crc;
  25.               crc = crc_clear();
  26.               /* for each character processed: */
  27.               crc = crc_update(crc, next_chr);
  28.               /* finally, */
  29.               crc = crc_finish;
  30.  
  31.  
  32.  
  33.        NOTE:
  34.        These functions are from a public domain source, author
  35.        unknown,  They are not copyrighted.
  36.  
  37.  
  38.  
  39.        This function is found in SMTCx.LIB for the Turbo-C Compiler.
  40.